package modele;

public class FreeResourceAction<R extends Resource> extends
		ResourcePoolAction<R> {

	public FreeResourceAction(ResourcePool<R> pool, ResourcefulUser<R> usr) {
		this.pool = pool;
		this.rfu = usr;
	}

	@Override
	public void tryAction() {
		pool.freeResource(rfu.getRessource());
		rfu.resetRessource();
		System.out.println("(free)");
	}

	@Override
	public boolean isReady() {
		return (!(rfu.getRessource() == null));
	}

	@Override
	public boolean isFinished() {
		return (rfu.getRessource() == null);
	}

}
